package com.longdaji.decoration.ui.main;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.longdaji.decoration.base.BaseFragment;

import java.util.List;

/**
 * 适配器
 * Created by qiudengjiao on 2017/5/6.
 */

public class MainTabAdapter extends FragmentPagerAdapter {

    private String[] mTitles;
    private List<BaseFragment> mFragments;

    public MainTabAdapter(FragmentManager fm, List<BaseFragment> fragments, String[] titles) {
        super(fm);
        this.mFragments = fragments;
        this.mTitles = titles;

    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];
    }
}
